<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>逆转世界</title>
</head>

<body>
    <div id="app">
        <h2>{{msg}}</h2>
        <button @click="btn">点击逆转</button>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>

    <script>
        const app = new Vue({
            el: '#app',//通过 e1 配置选择器，指定 Vue 管理的是哪个盒子
            data: {
                msg: 'Hello,World',
            },
            methods: {
                btn() {
                    this.msg = this.msg.split('').reverse().join('')
                }
            }
        })
    </script>
</body>

</html>